function getCharts(id,type){
	var myChart = echarts.init(document.getElementById(id));
    var data2 = [299,400,501,299,501,400,501,299,400,501,299,501,400,501,299,400,501,299,501,400,501];
    var data3 = [400,400,501,501,299,666,501,400,400,501,501,299,666,501,400,400,501,501,299,666,501];
    var data = [299,400,501,299,501,400,501];
    var array=[1300,2300,3400,4200,5100];
	var array1=[6470, 6470, 6470, 6470,6470];
	var data5 = [{
    value: 3661,
    name: '<10w',
        itemStyle: {
        normal: {
            color: 'rgba(0,255,255,0.58)',
            borderWidth: 1,
            borderColor: '#00ffff'
        }
    }
}, {
    value: 5713,
    name: '10w-50w',
    itemStyle: {
        normal: {
            color: 'rgba(55,201,54,0.6)',
            borderWidth: 1,
            borderColor: '#37c936'
        }
    }
}, {
    value: 9938,
    name: '50w-100w',
    itemStyle: {
        normal: {
            color: 'rgba(248,231,28,0.64)',
            borderWidth: 1,
            borderColor: '#F8E71C'
        }
    }
}, {
    value: 17623,
    name: '100w-500w',
    itemStyle: {
        normal: {
            color: 'rgba(249,95,182,0.53)',
            borderWidth: 1,
            borderColor: '#f95fb8'
        }
    }
}, {
    value: 3299,
    name: '>500w',
    itemStyle: {
        normal: {
            color: 'rgba(74,114,255,0.58)',
            borderWidth: 1,
            borderColor: '#4a72ff'
        }
    }
}];
//柱图1
var options1 = {
    	backgroundColor: 'none',
        tooltip : {
            trigger: 'axis',
            axisPointer : {            // 坐标轴指示器，坐标轴触发有效
            type : 'line'        // 默认为直线，可选为：'line' | 'shadow'
            }
        },
        grid: {
        	top:'10%',
            left: '3%',
            right: '4%',
            bottom: '17%',
            containLabel: true//grid 区域包含坐标轴的刻度标签。
        },
        xAxis : [
            {
                type : 'category',
                data : ['遂宁市','遂宁市','遂宁市','遂宁市','遂宁市','遂宁市','遂宁市','遂宁市','遂宁市','遂宁市','遂宁市','遂宁市','遂宁市','遂宁市','遂宁市','遂宁市','遂宁市','遂宁市','遂宁市','遂宁市','遂宁市'],
                axisTick: {
                    alignWithLabel: true//柱子剧中对齐
                },
                axisLabel: {
                	 rotate: 45, 
		            textStyle: {
		             	color: '#9a9bae',
		            }//刻度标签文字颜色
		        }
            }
        ],
        yAxis : [
            {
                type : 'value',
                axisLabel: {
		            textStyle: {
		             	color: '#9a9bae',
		            },//刻度标签文字颜色
		        },
		        axisTick :{
		        	show:false
		        }, //取消坐标中间刻度
		        axisLine:{
		        	lineStyle:{
		        		color:"#343448"
		        	}
		        },
		        splitLine: {
     			   	lineStyle: {
          		   		 color: 'rgba(0,255,255,0.19)',
      			    },//坐标轴在 grid 区域中的分隔线颜色
        		},
            }
        ],
        series : [
            {
                name:'2016年',
                type:'bar',
                barWidth: '40%',
            	label: {
		            normal: {
		                show: false,
		                position: 'top',
		                textStyle:{
		                	color:'#5b83e5',
		                }
		            }
		        },
                itemStyle: {
             		normal: {
             		 	color:' rgba(55,201,54,0.60)',
             		 	borderWidth: 2,
               				borderColor: '#37C936'
              },
            },
                data:data2
            },
             {
                name:'2016年',
                type:'line',
                barWidth: '28',
            	label: {
		            normal: {
		                show: false,
		                position: 'top',
		                textStyle:{
		                	color:'#5b83e5',
		                }
		            }
		        },
                itemStyle: {
             		normal: {
             		 	color:'#298434'
              		},
            },
                data:data2
            }]};
  //横轴柱状图1
var options2={
    	backgroundColor: 'none',
        grid: {
        	top:'0',
            left: '0%',
            right: '0%',
            bottom: '0%',
            containLabel: true//grid 区域包含坐标轴的刻度标签。
        	},
          xAxis : [{
                type : 'value',
                axisTick: {
                    alignWithLabel: true//柱子剧中对齐
                },
                splitLine:{
		        	show:false
                },
                axisLabel: {
		        	show:false
		        },
		          axisLine:{
		        	show:false,
		        },
		         axisTick :{
		        	show:false
		        }, //取消坐标中间刻度
            }],
        yAxis : [{
                type : 'category',
                data : ['峨眉山','峨眉山','峨眉山','峨眉山','峨眉山'],
                axisLabel: {
		            textStyle: {
		             	color: '#9a9bae',
		            },//刻度标签文字颜色
		        },
		        axisTick :{
		        	show:false
		        }, //取消坐标中间刻度
		        axisLine:{
		        	show:false,
		        },
		        splitLine: {
		        	show:false
        		},
           }],
         series: [{
        name: '月开支',
        type: 'bar',
        barGap: '-100%',
        barWidth: '45%',
        label: {
            normal: {
                textStyle: {
                    color: '#682d19'
                },
                position: 'left',
                show: false,
                formatter: '{b}'
            }
        },
        itemStyle: {
            normal: {
                color: 'rgba(0,255,255,0.1)',
                borderWidth: 2,
                borderColor: 'rgba(0,255,255,0.12)'

            }
        },
        data: array1
    }, {
        type: 'bar',
        silent: true,
        barGap: '-100%',
        barWidth: '45%',
        data: array,
        itemStyle: {
            normal: {
                color: '#1085C0',
                borderWidth: 1,
                borderColor: '#03CEF9'

            }
        },

    }]};
//横轴柱状图2
var options3={
    	backgroundColor: 'none',
        grid: {
        	top:'0',
            left: '0%',
            right: '0%',
            bottom: '0%',
            containLabel: true//grid 区域包含坐标轴的刻度标签。
        	},
        xAxis : [{
                type : 'value',
                axisTick: {
                    alignWithLabel: true//柱子剧中对齐
                },
                splitLine:{
		        	show:false
                },
                axisLabel: {
		        	show:false
		        },
		          axisLine:{
		        	show:false,
		        },
		         axisTick :{
		        	show:false
		        }, //取消坐标中间刻度
            }],
        yAxis : [{
                type : 'category',
                data : ['峨眉山','峨眉山','峨眉山','峨眉山','峨眉山'],
                axisLabel: {
		            textStyle: {
		             	color: '#9a9bae',
		            },//刻度标签文字颜色
		        },
		        axisTick :{
		        	show:false
		        }, //取消坐标中间刻度
		        axisLine:{
		        	show:false,
		        },
		        splitLine: {
		        	show:false
        		},
           }],
         series: [{
        type: 'bar',
        barGap: '-100%',
        barWidth: '45%',
        label: {
            normal: {
                textStyle: {
                    color: '#682d19'
                },
                position: 'left',
                show: false,
                formatter: '{b}'
            }
        },
        itemStyle: {
            normal: {
                color: 'rgba(0,255,255,0.1)',
                borderWidth: 2,
                borderColor: 'rgba(0,255,255,0.12)'

            }
        },
        data: array1
    }, {
        type: 'bar',
        silent: true,
        barGap: '-100%',
        data: array,
        barWidth: '45%',
        itemStyle: {
            normal: {
                color: '#1085C0',
                borderWidth: 1,
                borderColor: '#03CEF9'

            }
        },

    }]};    
//饼图1
var options4 = {
    	backgroundColor: 'none',
    tooltip: {  
        trigger: 'item',
        formatter: "{b}: {c} 人 ({d}%)"
    },
    textStyle: {
            color: '#fff'
        },
    series: [{
        type: 'pie',
        selectedMode: 'single',
       radius: ['34%', '76%'],
        color: ['#86D560', '#AF89D6', '#59ADF3', '#FF999A', '#FFCC67'],
         label: {
             normal: {
                 textStyle: {
                     fontSize: 14
                 },
                 formatter: function(param) {
                     return param.name + ':\n' + Math.round(param.percent) + '%';
                 }
             }
         },
 labelLine: {
             normal: {
                 lineStyle: {
                     width: 2,
                     color:'#00FFFF'
                 }
             }
         },
        data: data5
    }]};

	if(type =='bar'){
      	  myChart.setOption(options1);
    	}else if(type == 'bar-a'){
      	  myChart.setOption(options2);
    	}else if(type == 'bar-b'){
      	  myChart.setOption(options3);
    	}else if(type == 'pie'){
      	  myChart.setOption(options4);
    	}
    window.onresize = myChart.resize;

}
